#!/usr/bin/env python

from glp.library import Librarian
import glp.util

# There is a bug in Google Developer Storage and App Engine that
# prevents App Engine from copying files within or uploading files to
# GDS. This code is copied from library-manager.py and really
# shouldn't exist, but we need it to populate the library before this
# bug is fixed.

printer = glp.util.StdoutPrinter()
glp.util.InitializeFreeRangeProgram()
Librarian.EnsureStats()
for id in Librarian.PrepareImportableDocuments(printer):
    Librarian.ImportDocument(id, printer)
